package com.xiaoxiao.springbootstudy.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.xiaoxiao.springbootstudy.pojo.Order;
import com.xiaoxiao.springbootstudy.pojo.vo.CountResult;
import com.xiaoxiao.springbootstudy.pojo.vo.MonthOrder;
import com.xiaoxiao.springbootstudy.service.OrderService;
import com.xiaoxiao.springbootstudy.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @author XiaoXiao
* @description 针对表【t_order】的数据库操作Service实现
* @createDate 2025-05-13 14:45:56
*/
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order>
    implements OrderService{
    @Autowired
    private OrderMapper orderMapper;

    @Override
    public Map<String, Object> queryOrderListService(Integer pageNum, Integer pageSize, Order order) {
        Map<String, Object> map = new HashMap<String, Object>();

        Page page = PageHelper.startPage(pageNum, pageSize);
        List<Order> list = orderMapper.queryOrderListMapper(order);

        map.put("total", page.getTotal());
        map.put("list", list);

        return map;
    }

    @Override
    public List<MonthOrder> queryYearMonthOrderService() {
        return orderMapper.queryYearMonthOrderMapper();
    }

    @Override
    public List<CountResult> querySellNumService(String sellNum) {
        return orderMapper.querySellNumMapper(sellNum);
    }
}




